home *** CD-ROM | disk | FTP | other *** search
/ Video Toaster 4.2 / Video Toaster v4.2.iso / arexx / modeler / nextempty.lwm < prev    next >
Text File  |  1993-12-13  |  909b  |  51 lines

  1. /* CMD: Next Empty Layer
  2.  *
  3.  * Set foreground layers to next empty layer.  If it starts on a full layer,
  4.  * we go to the first empty.  If current layer is already empty, we go to
  5.  * next empty one.
  6.  */
  7.  
  8. SIGNAL ON ERROR
  9. SIGNAL ON SYNTAX
  10.  
  11. libadd = addlib("LWModelerARexx.port",0)
  12. call main
  13. if (libadd) then call remlib("LWModelerARexx.port")
  14. exit
  15.  
  16.  
  17. main:
  18.  
  19. emp = emptylayers()
  20. if (words(emp) = 0) then return
  21.  
  22. cur = curlayer()
  23.  
  24. /* Find highest empty layer in cur
  25.  */
  26. cur1 = 0
  27. do i=1 to words(cur)
  28.     l = word(cur,i)
  29.     if (pos(l, emp) ~= 0) then cur1 = l
  30. end i
  31.  
  32. /* Find next higher empty layer, or first empty layer if none
  33.  */
  34. do i=1 to words(emp)
  35.     l = word(emp,i)
  36.     if (l > cur1) then do
  37.     call setlayer l
  38.     return
  39.     end
  40. end i
  41.  
  42. call setlayer word(emp,1)
  43. return
  44.  
  45.  
  46. SYNTAX:
  47. ERROR:
  48.   t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL)
  49.   if (libadd) then call remlib("LWModelerARexx.port")
  50.   exit
  51.